package com.EAIPClub.LiveStreaming.controller;

import com.EAIPClub.LiveStreaming.service.LiveStreamingService;
import com.api.POJO.LiveStreaming.LiveStreamingBaseInfo;
import com.api.POJO.LiveStreaming.LiveStreamingReturnMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description :
 * @Author :
 * @Date : 2021/12/11
 */
@RestController
public class LiveStreamingController {

    private LiveStreamingService service;

    @Autowired
    public void setService(LiveStreamingService service) {
        this.service = service;
    }

    @GetMapping("/live/open/")
    public LiveStreamingReturnMsg openNewLiveStreaming(@RequestParam String token, @RequestParam String title,@RequestParam String line){
        LiveStreamingBaseInfo baseInfo = new LiveStreamingBaseInfo(title,line);
        return service.openNewLiveStreaming(token, baseInfo);
    }
    @GetMapping("/live/get/all")
    public LiveStreamingReturnMsg getAllLiveStreamingInfo(){
        return service.getAllLiveStreamingInfo();
    }
    @GetMapping("/live/close/{token}")
    public LiveStreamingReturnMsg closeLiveStreamingByToken(@PathVariable String token){
        return service.closeLiveStreamingByToken(token);
    }
}
